package strategy3;

import cn.hutool.core.map.MapUtil;
import strategy1.pay.IPayment;

import java.util.HashMap;
import java.util.Map;

public class MapStrategy {

    Map<String, Class> payMap = null;

    Map<String, String> map = new HashMap<>();


    public MapStrategy(){
        payMap = MapUtilCollect.getAllIPaymentImpl();
    }

    public Map<String, Class> getPayMap() {
        return this.payMap;
    }


    public Class<? extends IPayment> getInstance(String payChannel) throws IllegalAccessException, InstantiationException {
        if(MapUtil.isNotEmpty(payMap)){
          return   payMap.get(payChannel);
        }
        return null;
    }
}
